#pragma once


#include <atlddx.h>
#include <atlcrack.h>

#include "resource.h"




class CLicenseDlg : public CDialogImpl<CLicenseDlg>,
	                public CWinDataExchange<CLicenseDlg>
{
public:
	CLicenseDlg(void);
	~CLicenseDlg(void);

	WCHAR m_szSystemLicensePath[MAX_PATH];

	BOOL  m_bLicenseOK;
	WCHAR m_szLicensepPath[MAX_PATH];

	CListViewCtrl m_lcDate;

	CEdit m_edtFilePath;
	CEdit m_edtCode;
	CButton m_btnBrowse;

	enum { IDD = IDD_DLG_LICENSE };

	BEGIN_MSG_MAP(CLicenseDlg)
		MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
		COMMAND_ID_HANDLER(IDOK, OnCloseCmd)
		COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
		COMMAND_HANDLER_EX(IDC_BTN_CANCEL, BN_CLICKED, OnBtnCancelBnClicked)
		COMMAND_HANDLER_EX(IDC_BTN_OK, BN_CLICKED, OnBtnOkBnClicked)
		COMMAND_HANDLER_EX(IDC_BTN_BROWSE, BN_CLICKED, OnBtnBrowseBnClicked )
		COMMAND_HANDLER_EX(IDC_BTN_CLEAR, BN_CLICKED, OnBtnClearBnClicked )
		
		COMMAND_HANDLER(IDC_RADIO1, BN_CLICKED, OnBnClickedRadio1)
		COMMAND_HANDLER(IDC_RADIO2, BN_CLICKED, OnBnClickedRadio2)
		COMMAND_HANDLER(IDC_EDIT2, EN_CHANGE, OnEnChangeEdit2)
		COMMAND_HANDLER(IDC_EDIT2, EN_SETFOCUS, OnEnSetfocusEdit2)
	END_MSG_MAP()



public:

	LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
	LRESULT OnCloseCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/);

	LRESULT OnBtnCancelBnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl);
	LRESULT OnBtnOkBnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl);
	LRESULT OnBtnBrowseBnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl);
	LRESULT OnBtnClearBnClicked(WORD wNotifyCode, WORD wID, HWND hWndCtl);


	int ShowLicense(TCHAR* lpFilePath, BOOL fromSystem );
	int ShowRegCode( CString strCode );
	

	int Reset(void);
	int ResetDlgText(void);
	int ImportKtvLicense(WCHAR* lpszSRC, WCHAR* lpszDST);

	int EnableCodeReg( int enable );

	int HideLicenseFilePathCtrl( void );

	int ShowSystemMark( void );
	int OnLicenseRadioClicked( void );



	LRESULT OnBnClickedRadio1(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnBnClickedRadio2(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnEnChangeEdit2(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
	LRESULT OnEnSetfocusEdit2(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
};
